#!/bin/bash
# Rust 开发环境配置脚本
echo '# 配置 Rustup 中科大镜像源' >> ~/.bashrc
echo 'export RUSTUP_DIST_SERVER="https://mirrors.ustc.edu.cn/rust-static"' >> ~/.bashrc
echo 'export RUSTUP_UPDATE_ROOT="https://mirrors.ustc.edu.cn/rust-static/rustup"' >> ~/.bashrc
source ~/.bashrc

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
echo 'source "$HOME/.cargo/env"' >> ~/.bashrc

rustup target add thumbv7m-none-eabi
sudo apt install -y libssl-dev pkg-config libudev-dev
cargo install cargo-binutils cargo-generate
rustup component add llvm-tools